
#ifndef _RADIX_ENGINE_IMPL_COMPONENT_H_
#define _RADIX_ENGINE_IMPL_COMPONENT_H_

#include <Engine/Component.h>

_BeginNamespace(Radix)
/*
=================================================================
== ComponentSystem
=================================================================
*/
struct ComponentModule
{	
	Module* mModule;
	InitComponentModuleFunc mInitFunc;
	ExitComponentModuleFunc mExitFunc;
};

class ComponentSystem :public IComponentSystem
{
	typedef std::map<String, ComponentModule> ModuleMap;
	typedef std::map<String, IComponent*> ComponentMap;

public:
	ComponentSystem();
	virtual ~ComponentSystem();

public:
	virtual bool loadModule(const String& name);
	virtual void unloadModule(const String& name);
	virtual void unloadModules();

	virtual bool attachComponent(IComponent* component);
	virtual void detachComponent(IComponent* component);
	virtual bool containsComponent(const String& name);
	virtual IComponent* selectComponent(const String& name);

private:
	ModuleMap mModules;
	ComponentMap mComponents;
};

_EndNamespace(Radix)

#endif//_RADIX_ENGINE_IMPL_COMPONENT_H_
